package myky.com.doctorapp.presenter;

import io.reactivex.disposables.Disposable;
import myky.com.doctorapp.base.BasePresenterIm;
import myky.com.doctorapp.base.RxPageSubscribe;
import myky.com.doctorapp.contract.ChooseDissesTypeContract;
import myky.com.doctorapp.entity.ChooseDisesTypeEntity;
import myky.com.doctorapp.entity.PageEntity;
import myky.com.doctorapp.model.ChooseDissesTypeModel;

public class ChooseDissesTypePresenter extends BasePresenterIm<ChooseDissesTypeContract.View> implements ChooseDissesTypeContract.Presenter {
    ChooseDissesTypeModel chooseDissesTypeModel;

    public ChooseDissesTypePresenter() {
        chooseDissesTypeModel=new ChooseDissesTypeModel();
    }

    @Override
    public void findDissesType(String currentPage, String selectid, String selecttype, String pageSize, String version) {

        chooseDissesTypeModel.findDissesType(currentPage, selectid, selecttype, pageSize, version)
                .subscribe(new RxPageSubscribe<ChooseDisesTypeEntity>() {
                    @Override
                    protected void onSuccess(ChooseDisesTypeEntity chooseDisesTypeEntity, PageEntity pageEntity) {
                        mView.showDissesType(chooseDisesTypeEntity.getDiseaseList(),pageEntity);
                    }

                    @Override
                    protected void onFailed(int code, String msg) {
                        mView.logCat(msg);
                    }

                    @Override
                    public void onSubscribe(Disposable d) {
                        addSubscription(d);

                    }
                });



    }
}
